%To find the function Iphi which is the integral of S in the theta
%direction
function Iphi = thetaint(r,rpp,R)
if(R>=(r+rpp))
    Iphi=1;
elseif(R>=abs(r-rpp)& R<(r+rpp))
    Iphi=acos((r^2+rpp^2-R^2)/(2*r*rpp))*1/pi;
else
    Iphi=0;
end
    